const raw = '/static'

const faceList = [`${raw}/emoji/smile.webp`, `${raw}/emoji/tv/tv.webp`]

export type EmojiItem = {
  label: string
  img: string
  childrens?: EmojiItem[]
}
export const emojiList: EmojiItem[] = [
  {
    label: 'first',
    img: `${raw}/emoji/smile.webp`,
    childrens: [
      { label: '[口罩]', img: `${raw}/emoji/kouzhao.webp` },
      { label: '[狗头]', img: `${raw}/emoji/goutou.webp` },
      { label: '[微笑]', img: `${raw}/emoji/smile.webp` },
      { label: '[大笑2]', img: `${raw}/emoji/daxiao2.png` },
      { label: '[OK]', img: `${raw}/emoji/ok.webp` },
      { label: '[星星眼]', img: `${raw}/emoji/star.webp` },
      { label: '[辣眼睛]', img: `${raw}/emoji/layanjing.webp` },
      { label: '[吃瓜]', img: `${raw}/emoji/chigua.webp` },
      { label: '[滑稽]', img: `${raw}/emoji/huaji.webp` },
      { label: '[呲牙]', img: `${raw}/emoji/teeth.webp` },
      { label: '[打call]', img: `${raw}/emoji/dacall.webp` },
      { label: '[喝酒]', img: `${raw}/emoji/hejiu.webp` },
      { label: '[乖]', img: `${raw}/emoji/guai.webp` },
      { label: '[吐舌]', img: `${raw}/emoji/tushe.webp` },
      { label: '[汗]', img: `${raw}/emoji/han.webp` },
      { label: '[大哭2]', img: `${raw}/emoji/daku.webp` },
      { label: '[超赞]', img: `${raw}/emoji/chaozan.webp` },
      { label: '[超开心]', img: `${raw}/emoji/chaokaixin.webp` },
      { label: '[委屈]', img: `${raw}/emoji/weiqu.webp` },
      { label: '[困狗]', img: `${raw}/emoji/kungou.webp` },
      { label: '[藏狐]', img: `${raw}/emoji/zanghu.webp` },
      { label: '[脸红]', img: `${raw}/emoji/lianhong.webp` },
      { label: '[脱单doge]', img: `${raw}/emoji/doge.webp` },
      { label: '[给心心]', img: `${raw}/emoji/heart.webp` },
      { label: '[笑]', img: `${raw}/emoji/dx.webp` },
      { label: '[哦呼]', img: `${raw}/emoji/oh.webp` },
      { label: '[嫌弃]', img: `${raw}/emoji/xq.webp` },
      { label: '[喜欢]', img: `${raw}/emoji/like.webp` },
      { label: '[酸了]', img: `${raw}/emoji/sl.webp` },
      { label: '[大哭]', img: `${raw}/emoji/dq.webp` },
      { label: '[害羞]', img: `${raw}/emoji/hx.webp` },
      { label: '[无语]', img: `${raw}/emoji/wy.webp` },
      { label: '[疑惑]', img: `${raw}/emoji/yh.webp` },
      { label: '[调皮]', img: `${raw}/emoji/tiaopi.webp` },
      { label: '[笑哭]', img: `${raw}/emoji/xiaoku.webp` },
      { label: '[奸笑]', img: `${raw}/emoji/jianxiao.webp` },
      { label: '[偷笑]', img: `${raw}/emoji/touxiao.webp` },
      { label: '[大笑]', img: `${raw}/emoji/daxiao.webp` },
      { label: '[阴险]', img: `${raw}/emoji/yinxian.webp` },
      { label: '[捂脸]', img: `${raw}/emoji/wulian.webp` },
      { label: '[惊喜]', img: `${raw}/emoji/jingxi.webp` },
      { label: '[惊讶]', img: `${raw}/emoji/jingya.webp` },
      { label: '[捂脸哭]', img: `${raw}/emoji/wulianku.webp` },
      { label: '[妙啊]', img: `${raw}/emoji/miaoa.webp` },
      { label: '[鼓掌]', img: `${raw}/emoji/guzhang.webp` },
      { label: '[尴尬]', img: `${raw}/emoji/ganga.webp` },
      { label: '[冷]', img: `${raw}/emoji/cold.webp` },
      { label: '[灵魂出窍]', img: `${raw}/emoji/linghunchuqiao.webp` },
      { label: '[傲娇]', img: `${raw}/emoji/aojiao.webp` },
      { label: '[疼]', img: `${raw}/emoji/teng.webp` },
      { label: '[吓]', img: `${raw}/emoji/xia.webp` },
      { label: '[生病]', img: `${raw}/emoji/shengbing.webp` },
      { label: '[吐]', img: `${raw}/emoji/tu.webp` },
      { label: '[嘘声]', img: `${raw}/emoji/xusheng.webp` },
      { label: '[捂眼]', img: `${raw}/emoji/wuyan.webp` },
      { label: '[思考]', img: `${raw}/emoji/sikao.webp` },
      { label: '[再见]', img: `${raw}/emoji/zaijian.webp` },
      { label: '[翻白眼]', img: `${raw}/emoji/fanbaiyan.webp` },
      { label: '[哈欠]', img: `${raw}/emoji/haqian.webp` },
      { label: '[奋斗]', img: `${raw}/emoji/fengdou.webp` },
      { label: '[墨镜]', img: `${raw}/emoji/mojing.webp` },
      { label: '[撇嘴]', img: `${raw}/emoji/piezui.webp` },
      { label: '[难过]', img: `${raw}/emoji/nanguo.webp` },
      { label: '[抓狂]', img: `${raw}/emoji/zhuakuang.webp` },
      { label: '[生气]', img: `${raw}/emoji/shengqi.webp` },
      { label: '[爱心]', img: `${raw}/emoji/aixin.webp` },
      { label: '[胜利]', img: `${raw}/emoji/shengli.webp` },
      { label: '[抱拳]', img: `${raw}/emoji/baoquan.webp` },
      { label: '[保佑]', img: `${raw}/emoji/baoyou.webp` },
      { label: '[支持]', img: `${raw}/emoji/zhichi.webp` }
    ]
  },
  {
    label: 'second',
    img: `${raw}/emoji/tv/tv.webp`,
    childrens: [
      { label: '[tv_doge]', img: `${raw}/emoji/tv/doge.webp` },
      { label: '[tv_坏笑]', img: `${raw}/emoji/tv/huaixiao.webp` },
      { label: '[tv_难过]', img: `${raw}/emoji/tv/nanguo.webp` },
      { label: '[tv_生气]', img: `${raw}/emoji/tv/shengqi.webp` },
      { label: '[tv_委屈]', img: `${raw}/emoji/tv/weiqu.webp` },
      { label: '[tv_斜眼笑]', img: `${raw}/emoji/tv/xieyanxiao.webp` },
      { label: '[tv_呆]', img: `${raw}/emoji/tv/dai.webp` },
      { label: '[tv_发怒]', img: `${raw}/emoji/tv/fanu.webp` },
      { label: '[tv_惊吓]', img: `${raw}/emoji/tv/jingxia.webp` },
      { label: '[tv_呕吐]', img: `${raw}/emoji/tv/outu.webp` },
      { label: '[tv_思考]', img: `${raw}/emoji/tv/sikao.webp` },
      { label: '[tv_微笑]', img: `${raw}/emoji/tv/weixiao.webp` },
      { label: '[tv_疑问]', img: `${raw}/emoji/tv/yiwen.webp` },
      { label: '[tv_大哭]', img: `${raw}/emoji/tv/daku.webp` },
      { label: '[tv_鼓掌]', img: `${raw}/emoji/tv/guzhang.webp` },
      { label: '[tv_抠鼻]', img: `${raw}/emoji/tv/koubi.webp` },
      { label: '[tv_亲亲]', img: `${raw}/emoji/tv/qinqin.webp` },
      { label: '[tv_调皮]', img: `${raw}/emoji/tv/tiaopi.webp` },
      { label: '[tv_笑哭]', img: `${raw}/emoji/tv/xiaoku.webp` },
      { label: '[tv_晕]', img: `${raw}/emoji/tv/yun.webp` },
      { label: '[tv_点赞]', img: `${raw}/emoji/tv/dianzan.webp` },
      { label: '[tv_害羞]', img: `${raw}/emoji/tv/haixiu.webp` },
      { label: '[tv_睡着]', img: `${raw}/emoji/tv/shuizhe.webp` },
      { label: '[tv_色]', img: `${raw}/emoji/tv/se.webp` },
      { label: '[tv_吐血]', img: `${raw}/emoji/tv/tuxue.webp` },
      { label: '[tv_无奈]', img: `${raw}/emoji/tv/wunai.webp` },
      { label: '[tv_再见]', img: `${raw}/emoji/tv/zaijian.webp` },
      { label: '[tv_流汗]', img: `${raw}/emoji/tv/liuhan.webp` },
      { label: '[tv_偷笑]', img: `${raw}/emoji/tv/touxiao.webp` },
      { label: '[tv_抓狂]', img: `${raw}/emoji/tv/zhuakuang.webp` },
      { label: '[tv_黑人问号]', img: `${raw}/emoji/tv/wenhao.webp` },
      { label: '[tv_困]', img: `${raw}/emoji/tv/kun.webp` },
      { label: '[tv_打脸]', img: `${raw}/emoji/tv/dalian.webp` },
      { label: '[tv_闭嘴]', img: `${raw}/emoji/tv/bizui.webp` },
      { label: '[tv_鄙视]', img: `${raw}/emoji/tv/bishi.webp` },
      { label: '[tv_腼腆]', img: `${raw}/emoji/tv/miantian.webp` },
      { label: '[tv_馋]', img: `${raw}/emoji/tv/chan.webp` },
      { label: '[tv_可爱]', img: `${raw}/emoji/tv/keai.webp` },
      { label: '[tv_发财]', img: `${raw}/emoji/tv/facai.webp` },
      { label: '[tv_生病]', img: `${raw}/emoji/tv/shengbing.webp` },
      { label: '[tv_流鼻血]', img: `${raw}/emoji/tv/liubixue.webp` },
      { label: '[tv_尴尬]', img: `${raw}/emoji/tv/ganga.webp` },
      { label: '[tv_大佬]', img: `${raw}/emoji/tv/dalao.webp` },
      { label: '[tv_流泪]', img: `${raw}/emoji/tv/liulei.webp` },
      { label: '[tv_冷漠]', img: `${raw}/emoji/tv/lenmo.webp` },
      { label: '[tv_皱眉]', img: `${raw}/emoji/tv/zhoumei.webp` },
      { label: '[tv_鬼脸]', img: `${raw}/emoji/tv/guilian.webp` },
      { label: '[tv_调侃]', img: `${raw}/emoji/tv/tiaokan.webp` },
      { label: '[tv_目瞪口呆]', img: `${raw}/emoji/tv/mudengkoudai.webp` }
    ]
  }
]

// 把emojiList数组中的每一个对象，放到emojiMap中方便取用
export function allEmoji(): EmojiItem[] {
  let emojiMap: EmojiItem[] = []
  emojiMap = [...emojiList]
  return emojiMap
}

export function findItemByLabel(label: string, list: EmojiItem[]): EmojiItem | null {
  for (let i = 0; i < list.length; i++) {
    if (list[i].label === label) {
      return list[i]
    }

    // @ts-ignore
    if (list[i].childrens && list[i].childrens.length > 0) {
      // @ts-ignore
      const result = findItemByLabel(label, list[i].childrens)
      if (result) return result
    }
  }

  return null
}
export default {
  faceList,
  emojiList,
  allEmoji: allEmoji()
}
